home *** CD-ROM | disk | FTP | other *** search
/ Zoom 2 / Zoom - Release 2 (1996)(Active Software)[!].iso / graphics / raytracing / imagineutils / iiutilities / imtotal < prev    next >
Text File  |  1995-01-18  |  3KB  |  95 lines

  1. /*\ 
  2.  *  ImTotal.rexx by IanSmith@moose.erie.net
  3.  *  Last revised: Wednesday 25-May-94 17:08:57
  4.  *  ---------------------------------------------------
  5.  *    Display rendering times for Imagine IFF files.
  6.  *    Imagine adds a IMRT hunk to all IFF files that
  7.  *    contains the date of the start and end of
  8.  *    rendering.  This script will decode and display
  9.  *    the rendering times for those pictures.  Version
  10.  *    2.2 of rexxarplib.library is needed for wildcard
  11.  *    support.  Format for times are, days hh:mm:ss.
  12. \*/
  13.  
  14. If ~Show(l,'libs:rexxarplib.library') Then
  15.  If ~AddLib('libs:rexxarplib.library',0,-30,0) Then
  16.   Say "Oh no, rexxarplib.library is missing! No wildcards..."
  17. Total=0; TotalFiles=0
  18. Parse Arg PatternArg
  19. If Strip(PatternArg)="" Then Do
  20.  Say "Please specify filename(s)"
  21.  Say " Wildcards are supported if rexxarplib.library"
  22.  Say " is installed in your libs: directory."
  23.  Exit
  24. End
  25.  
  26. Do Num=1 To Words(PatternArg)
  27.  Pattern=Word(PatternArg,Num)
  28.  If Show(l,'libs:rexxarplib.library') Then      /* If rexxarplib is not */
  29.   Matches=FileList(Pattern,Files,"F")           /* here, try a single   */
  30.  Else Do                                        /* file instead.        */
  31.   Matches=1
  32.   Files.1=Pattern
  33.  End
  34.  Do I=1 To Matches
  35.   Call Close(In)
  36.   If Open(In,Files.I,"R")=0 Then
  37.    Do
  38.     Say "Can't open" Files.I
  39.     Iterate
  40.    End
  41.   HunkHeader=ReadCH(In,8)
  42.   If Left(HunkHeader,4)~="FORM" Then Do  /* This does not handle CAT files */
  43. /* Say Files.I "is not an IFF." */       /* or nested ILBMs.  Imagine only */
  44.    Iterate                               /* puts out standard IFFs anyway. */
  45.   End
  46.   HunkHeader=ReadCH(In,4)
  47.   If HunkHeader~="ILBM" Then Do
  48. /* Say Files.I "is not an ILBM." */      /* Remove the comments if you like */
  49.    Iterate                               /* error messages.                 */
  50.   End
  51.   Done="F"; Days=""
  52.   Do UNTIL EOF(In) | Done="T"
  53.    HunkHeader=ReadCH(In,8)
  54.    If Left(HunkHeader,4)="BODY" Then    /* Stuff COULD come after the BODY */
  55.     Done="T"                            /* hunk, but I've never seen it.   */
  56.    Else Do
  57.     HunkData=ReadCH(In,C2D(Right(HunkHeader,4)))
  58.     If Left(HunkHeader,4)="IMRT" Then Do
  59.      SubTotal=Abs(C2D(Right(HunkData,4))-C2D(Left(HunkData,4)))
  60.      Total=Total+SubTotal
  61.      TotalFiles=TotalFiles+1
  62.      If SubTotal%86400>0 Then
  63.       Days=SubTotal%86400"d "
  64.      Say Days||SubTotal%3600":"Right(SubTotal%60//60,2,"0")":"Right(SubTotal//60,2,"0") Files.I
  65.     End
  66.    End
  67.   End
  68.  End
  69. End
  70.  
  71. If Total=0 Then
  72.  Say "No files found."
  73. Else Do
  74.  Days=Total%86400                       /* If anyone needs this printed   */
  75.  Hours=Right(Total%3600//24,2,"0")      /* in weeks and months, save your */
  76.  Minutes=Right(Total%60//60,2,"0")      /* money and get a 68060. :-)     */
  77.  Seconds=Right(Total//60,2,"0")
  78.  If Days=0 Then Days=""
  79.  Else Days=Days"d "
  80.  TDays=(Total/TotalFiles)%86400
  81.  THours=Right((Total/TotalFiles)%3600//24,2,"0")
  82.  TMinutes=Right((Total/TotalFiles)%60//60,2,"0")
  83.  TSeconds=Right((Total/TotalFiles)%1//60,2,"0")
  84.  If TDays=0 Then TDays=""
  85.  Else TDays=TDays"d "
  86.  If TotalFiles=1 Then
  87.   YSN=""
  88.  Else
  89.   YSN="s"
  90.  Say "Total rendering time:" Days||Hours":"Minutes":"Seconds "("TotalFiles "file"YSN")"
  91.  If TotalFiles>1 Then
  92.   Say " Average render time:" TDays||THours":"TMinutes":"TSeconds
  93. End
  94.  
  95.